home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5771 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.1 KB

  1. Path: news.uunet.ca!onlsys!ken.sheffield
  2. From: ken.sheffield@onlinesys.com (KEN SHEFFIELD)
  3. Newsgroups: comp.lang.c
  4. Subject: RE: WHY WON'T THIS COMPIL
  5. Message-ID: <8BB14D1.07940016F2.uuout@onlinesys.com>
  6. Date: Mon, 19 Feb 96 20:33:00 -500
  7. Distribution: world
  8. Organization: Online Systems Of Canada
  9. Reply-To: ken.sheffield@onlinesys.com (KEN SHEFFIELD)
  10. References: <4g50et$9lh@steel.interlog.com>
  11. X-Newsreader: PCBoard Version 15.22
  12. X-Mailer: PCBoard/UUOUT Version 1.20
  13.  
  14. TOPIC: Re: Why won't this compil
  15.  
  16.  KK>      Hi.  Can someone please explain why this program won't
  17.  KK> compile without errors?  I am using Power C under DOS.
  18.  
  19.  
  20.  KK> Heres the ANSI-C code:
  21.  
  22.  KK> #include <stdio.h>
  23.  KK> #include <stdlib.h>
  24.  
  25.  KK> void swap(int *, int *);
  26.  
  27.  KK> main()
  28.  KK> {
  29.  KK>      int var1, var2;
  30.  
  31.  KK>      var1 = 25;
  32.  KK>      var2 = 99;
  33.  KK>      printf("Variables before swap");
  34.  KK>      printf("var1 = %d , var2 = %d\n",var1,var2);
  35.  
  36.  KK>      swap(&var1, &var2);
  37.  KK>      printf("Variables after swap");
  38.  KK>      printf("var1 = %d , var2 = %d\n,var1,var2);
  39.  KK> }                                  ^"^forgot a quote.
  40.  
  41.  KK> void swap(int *ptr1,int *ptr2)
  42.  KK> {
  43.  KK>      int temp;
  44.  KK>      temp = *ptr1;
  45.  KK>      *ptr1 = *ptr2;
  46.  KK>      *ptr2 = temp;
  47.  KK> }
  48.  
  49.  KK> -----------------------------
  50.  KK> And, heres the C.ERR file:
  51.  
  52.  KK> pointc~1.txt(18):}
  53.  KK> ****************                ^202
  54.  KK>       202: String constant cannot span lines
  55.  KK> ------------------------------------------------------------
  56.  KK> pointc~1.txt(20):void swap(int *ptr1,int *ptr2)
  57.  KK> **************** ^  4, 14           ^  6    ^104,222,  6,104,222
  58.  KK>         4: ')' expected
  59.  KK>        14: ';' expected
  60.  KK>         6: Illegal symbol
  61.  KK>       104: Undeclared identifier
  62.  KK>       222: Warning - Pointer does not match scalar (int, long, etc)
  63.  KK> ------------------------------------------------------------
  64.  KK> pointc~1.txt(21):{
  65.  KK> **************** ^ 14
  66.  KK>        14: ';' expected
  67.  KK> ------------------------------------------------------------
  68.  KK> pointc~1.txt(23):        temp = *ptr1;
  69.  KK> ****************                     ^104,141
  70.  KK>       104: Undeclared identifier
  71.  KK>       141: Type of variable is not pointer
  72.  KK> ------------------------------------------------------------
  73.  KK> pointc~1.txt(24):        *ptr1 = *ptr2;
  74.  KK> ****************              ^104,141,104,141
  75.  KK>       104: Undeclared identifier
  76.  KK>       141: Type of variable is not pointer
  77.  KK> ------------------------------------------------------------
  78.  KK> pointc~1.txt(25):        *ptr2 = temp;
  79.  KK> ****************              ^104,141
  80.  KK>       104: Undeclared identifier
  81.  KK>       141: Type of variable is not pointer
  82.  KK> ------------------------------------------------------------
  83.  KK> pointc~1.txt(26):}
  84.  KK> ****************  ^  9
  85.  KK>         9: Right braces expected
  86.  KK> ------------------------------------------------------------
  87.  
  88.  
  89.  KK> Any help will be appericated.  Please email respones directly to
  90.  KK> me.  Thank's.
  91.  
  92.  
  93.  
  94.  KK>           KING KAOS
  95.  
  96. KEN SHEFFIELD
  97.  
  98. ... Hello? #TF# Are you there? Earth to #TF@ ? Hello?
  99.  * Evaluation copy of Silver Xpress. Day # 89
  100.  * Silver Xpress V4.3
  101.